/* Copyright (C) 
 * 
 * Disclaim
 * This program is the property of AI Speech Ltd. It shall be communicated to
 * authorized personnel only. It is not to be disclosed outside the group without
 * prior written consent. If you are not sure if you’re authorized to read this
 * program, please contact info@aispeech.com before reading.
 * 
 */

/**
 * @file wtk_utils_str_dis.h
 * 
 * @brief functions to compute distance of two string
 * 
 * @author wxm71(weixing.mei@aispeech.com)
 * 
 * @version 0.0.2
 * 
 * @date 2015-04-16
 */


#ifndef ___WXM71___AISPEECH_WTK_UTILS_STR_DIS__HEADER___
#define ___WXM71___AISPEECH_WTK_UTILS_STR_DIS__HEADER___

#ifdef __cplusplus 
extern "C" {
#endif 

/**
 * @brief longest common substring
 */
int wtk_utils_str_dis_lcs(char *dataL, int lenL, char *dataR, int lenR);


/**
 * @brief longest continus common sub-string
 */
int wtk_utils_str_dis_lccs(char *dataL, int lenL, char *dataR, int lenR);


/**
 * @brief edit distance(levenshtein distance)
 */
int wtk_utils_str_dis_edit(char *dataL, int lenL, char *dataR, int lenR);

/**
 * @brief similarity base on edit distance
 */
float wtk_utils_str_sim_edit(char *dataL, int lenL, char *dataR, int lenR);

/**
 * @brief compute [dataR, lenR]'s similarity with [dataL, lenL], based on lcs
 *
 * dataR is master string, that's, 
 * if
 *      dataL = abc
 *      dataR = abcd
 * then 
 *      wtk_utils_str_sim_lcs(dataL, dataR) = 3/4 = 0.75
 *      wtk_utils_str_sim_lcs(dataR, dataL) = 3/3 = 1.0
 * end
 */
float wtk_utils_str_sim_lcs(char *dataL, int lenL, char *dataR, int lenR);


#ifdef __cplusplus  
};
#endif

#endif

